package com.xianggu.spring.aop.enums;

import com.xianggu.spring.aop.annotation.*;

/**
 * @author chengjy
 * @date 2025/3/10
 */
public enum AdviceType {

    BEFORE,
    AFTER,
    AFTER_THROWING,
    AFTER_RETURNING,
    AROUND;

    public static AdviceType getAdviceType(Class classAnno)
    {
        if(classAnno.equals( Before.class)){
            return AdviceType.BEFORE;
        }else if (classAnno.equals( After.class)){
            return AdviceType.AFTER;
        }else if (classAnno.equals( AfterReturning.class)){
            return AdviceType.AFTER_RETURNING;
        }else if (classAnno.equals( AfterThrowing.class)){
            return AdviceType.AFTER_THROWING;
        }else if (classAnno.equals( Around.class)){
            return AdviceType.AROUND;
        }
        throw new RuntimeException("没有找到对应的AdviceType");
    }
}
